<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
    <title></title>
    <meta charset="utf-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<link rel="stylesheet" href="css/ui-box.css">
    <link rel="stylesheet" href="css/ui-base.css">
    <link rel="stylesheet" href="css/ui-color.css">
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/img.css">

	<script src="js/core/zy_control.js"></script>
    <script src="js/core/zy_click.js"></script>
    <script src="js/core/appframework.js"></script>
    <script src="js/main.js"></script>
    <script src="js/core.js"></script>
    <script src="js/res.js"></script>
    
    <script src="js/signup.js"></script>

</head>
<body class="ub ub-ver">
    <div class="up3 ub-f1">
        <div class="ub umt_2 ub-ac ub-pc">
            <div class="uplr_p5 uc-a1 ub-f1"><input id="phone" placeholder="手机号" type="number" class="input_signup"><div class="b-bla signup_input_ctn"></div></div>
            <input id="code" class="ufp8 ub_center upp5 uh2 tx-c" type="button" value="获取验证码">
        </div>
        
        <div class="uplr_p5 uc-a1 umt_1"><input id="phonecode" placeholder="验证码" type="number" class="input_signup"><div class="b-bla signup_input_ctn"></div></div>
        <div class="uplr_p5 uc-a1 umt_1"><input id="pwd" placeholder="新密码" type="password" class="input_signup"><div class="b-bla signup_input_ctn"></div></div>
        <div class="umt_1 ufp8">* 提示：手机号、验证码、新密码是必填项</div>
    </div>
</body>
</html>
<script>
zy_init();

var wait=60;
document.getElementById("code").disabled = false;   
function time(o) {
    if (wait == 0) {
        o.removeAttribute("disabled");           
        o.value="验证码";
        wait = 60;
    } else {
        o.setAttribute("disabled", true);
        o.value= wait + "秒";
        wait--;
        setTimeout(function() {
            time(o)
        },
        1000)
    }
}
document.getElementById("code").onclick=function(){
    if (!checkMobile($("#phone").val()))
        return;
    var $this = this;
    $ajax({
        url: "/user/findPwd",
        data: {
            value: $("#phone").val(),
            field: "phone"
        },
        success: function(res) {
            $alert("验证码发送成功");
            time($this);
        }
    });
}
window.uexOnload = function(type){
    if (!type) {
        Res.gnTitle({title:"找回密码", rightTitle:"完成", rightFn:function(){
            $ajax({
                url: "/user/resetPassword",
                data: {
                    field: "phone",
                    value: $("#phone").val(),
                    code: $("#phonecode").val(),
                    password: $("#pwd").val()
                },
                success: function(res) {
                    $alert("修改成功，请重新登录.");
                    WinClose();
                }
            });
        }});
        Add20ToHeader();
    }
}
</script>